package com.meowcook.pojo.po;

import lombok.Data;

import java.util.Date;

@Data
public class User {

    private Long id;

    private String username;

    private String password;

    private String nickname;

    private String phoneNum;

    private String email;

    private Byte gender;

    private String salt;

    private String avatarUrl;

    private Integer recipeCount;

    private Integer fansCount;

    private Integer followCount;

    private Byte isAdmin;

    private String bio;

    private Byte status;

    private Byte isDeleted;

    private Date createTime;

    private Date updateTime;

    public static User builder(String username, String password, String salt) {
        User user = new User();
        user.setUsername(username);
        user.setPassword(password);
        user.setSalt(salt);
        user.setNickname("小馋猫");//默认昵称
        user.setGender((byte) 2); //默认保密
        user.setPhoneNum(null);
        user.setEmail(null);
        user.setAvatarUrl(null);
        user.setBio("喵!? 小馋猫也有大厨梦！");
        user.setStatus((byte) 2);
        user.setIsAdmin((byte) 0);
        user.setFansCount(0);
        user.setFollowCount(0);
        user.setRecipeCount(0);
        user.setIsDeleted((byte) 0);
        Date now = new Date();
        user.setCreateTime(now);
        user.setUpdateTime(now);
        return user;
    }
}